fix(AttemptCompletionTool): child tasks return to parent when parent status is active#510
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR addresses issue ChangesSubtask delegation and cross-profile completion flow
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
5bc3c89 to
d7a98bc
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/vscode-e2e/src/fixtures/subtasks.ts`:
- Around line 57-73: The first-turn new_task fixture created via mock.addFixture
that matches on userMessage / SUBTASK_FAST_PARENT_MARKER should include
sequenceIndex: 0 so it only fires once; update that fixture object to add
sequenceIndex: 0 and keep the response.toolCalls entry (id:
"call_subtasks_fast_parent_new_task_001") unchanged. Also tighten the x-profile
resumed-parent fixture predicate so it does not rely on the embedded
SUBTASK_XPROFILE_SAME_CHILD_RESULT string inside SUBTASK_XPROFILE_PARENT_PROMPT;
instead key the matcher to the child completion (for example by matching the
child tool call id or the child tool result field / toolCallId emitted when the
child finishes) so the resumed-parent fixture only triggers after the child tool
call completes.
In `@apps/vscode-e2e/src/suite/subtasks.test.ts`:
- Around line 359-366: The test is overwriting persisted modeApiConfigs and then
clearing them; instead capture the original configuration before calling
api.setConfiguration (e.g., read and store the result of api.getConfiguration or
the current modeApiConfigs into a variable) and in suiteTeardown restore that
saved configuration by calling api.setConfiguration with the saved
modeApiConfigs (instead of setting {}). Update both places that clear configs
(the block around api.upsertProfile / api.setConfiguration and the other
instance at lines 433-435) to save the prior config before mutating and restore
it in the teardown so subsequent suites retain the original routing/default
config.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3ab8db0d-3d38-44f4-98a2-3228ed0bb671
📒 Files selected for processing (6)
apps/vscode-e2e/src/fixtures/subtasks.tsapps/vscode-e2e/src/suite/subtasks.test.tssrc/__tests__/history-resume-delegation.spec.tssrc/core/tools/AttemptCompletionTool.tssrc/core/tools/__tests__/attemptCompletionTool.spec.tssrc/core/webview/ClineProvider.ts
Related GitHub Issue
Fixes: #457
Description
Child tasks were failing to return to their parent after calling
attempt_completionin v3.56+. The regression was reported on Discord; downgrading to v3.55 restored the behaviour.Root cause confirmed: Issue #457 describes the exact sequence. When a same-profile child completes and the parent resumes, the parent status is transiently
"active"while it awaits the next (different-profile) child. The guard inAttemptCompletionToolpreviously requiredparentStatus === "delegated"to proceed. Since the status was"active", the guard rejected the return and the child fell through to standalone completion.Fix: Both delegation guards now accept
"active"in addition to"delegated"whenawaitingChildIdmatches the returning child. Cancellation remains protected because cancellation clearsawaitingChildId.Changes:
AttemptCompletionTool: AcceptparentStatus === "active"whenawaitingChildIdmatches the returning child.ClineProvider#reopenParentFromDelegation: Same guard relaxation for symmetry.subtasks.test.ts: E2e regression test reproducing the exact Subtask never returns to parent after a per-mode model/profile switch (attempt_completion silently waits for human) #457 sequence — same-profile child returns first, parent delegates to a different-profile child, both complete and parent resumes.attemptCompletionTool.spec.ts: Unit tests covering all guard boundary cases including the new path and the mismatched-awaitingChildIdrejection.Test Procedure
Pre-Submission Checklist
Documentation Updates
Additional Notes
The Discord reporter's original trigger has not been reproduced in isolation — history navigation while a child is active produces the same symptom but via a separate path. This PR fixes the confirmed #457 sequence. Diagnostic logging from the first commit remains in place to surface any remaining unknown trigger.
Get in Touch
Discord: edelauna
Summary by CodeRabbit
Tests
Improvements